package day01_07.day05;

import java.util.Arrays;
import java.util.Scanner;

public class Main02 {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < array.length; i++) {
            array[i] = scn.nextInt();
        }
        int num = 0;
        for (int i = 0; i < array.length - 1; i++) {
            num = num > array[i] + array[i + 1] ? num : array[i] + array[i + 1];
        }
        System.out.println(num);


    }
}
